package com.cneiu.ppms.web.action;

import java.util.List;

import com.cneiu.ppms.web.base.BaseController;
import com.cneiu.ppms.web.model.MenuRoleModel;
import com.cneiu.ppms.web.service.MenuRoleService;
/**
 * 菜单角色控制器
 * @author zhaokf
 * @date 2013-04-23
 */
public class MenuRoleController extends BaseController{
	/**
	 * 菜单角色添加
	 */
	public void add(){
		try{
			if(!MenuRoleService.isAdd(this.getParams())){
				renderAjax(false, MenuRoleService.getError());
			}else{
				renderAjax(true, "添加菜单角色信息成功");
			}
		}catch (Exception e){
			e.printStackTrace();
		}

	}
	

	/**
	 * 根据ID查询菜单角色
	 */
	public void get(){
		try{
			List<MenuRoleModel> model = MenuRoleService.get(this.getParams());
			renderGrid(model);
		}catch (Exception e){
			e.printStackTrace();
		}
	}

	/**
	 * 菜单角色删除
	 */
	public void delete(){
		try{
			if (!MenuRoleService.isDelete(this.getParams())){
				renderAjax(false, MenuRoleService.getError());
			}else{
				renderAjax(true, "删除菜单角色信息成功");
			}
		}
		catch (Exception e){
			e.printStackTrace();
		}
	}
}
